<html>
<head>
	<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no">
		<script type='text/javascript'>
	 // define client loging function
	 if(window.location.hostname.indexOf('dev.tapulous.com')>=0){
		 var clog=function(str){ $.post('/tapulous/clientlog/clientlog.php',{msg:str});};
	 } else {
		 var clog=function(){};
	 }
  </script>
		<script type='text/javascript'>
		if(typeof _bootInterval != 'undefined') { clearInterval(_bootInterval); } 
		Cache.base = 1270752624;// this isn't really used anymore, since we always forcefully replace the cache onload
				Views.protocol = null;// ttr3cmd etc
function fix_ipad() {
	var re  =  new RegExp("window.location.+?\"(.+)\:");
	var ar = re.exec(Views.app);
	var ttrcmd = ar[1];
	Views.protocol = ttrcmd;
	if (ttrcmd && ttrcmd.length>3) {
		Views.app = function(cmd) { if(navigator.platform != "MacIntel") { window.location = ttrcmd + "://" + cmd; }};
	}
}
fix_ipad();


					(function(){var aa="_gat",ba="_gaq",r=true,v=false,w=undefined,ca="4.6.5",x="length",y="cookie",A="location",B="&",C="=",D="__utma=",E="__utmb=",G="__utmc=",da="__utmk=",H="__utmv=",J="__utmz=",K="__utmx=",L="GASO=";var N=function(i){return w==i||"-"==i||""==i},ea=function(i){return i[x]>0&&" \n\r\t".indexOf(i)>-1},P=function(i,l,g){var t="-",k;if(!N(i)&&!N(l)&&!N(g)){k=i.indexOf(l);if(k>-1){g=i.indexOf(g,k);if(g<0)g=i[x];t=O(i,k+l.indexOf(C)+1,g)}}return t},Q=function(i){var l=v,g=0,t,k;if(!N(i)){l=r;for(t=0;t<i[x];t++){k=i.charAt(t);g+="."==k?1:0;l=l&&g<=1&&(0==t&&"-"==k||".0123456789".indexOf(k)>-1)}}return l},S=function(i,l){var g=encodeURIComponent;return g instanceof Function?l?encodeURI(i):g(i):escape(i)},
T=function(i,l){var g=decodeURIComponent,t;i=i.split("+").join(" ");if(g instanceof Function)try{t=l?decodeURI(i):g(i)}catch(k){t=unescape(i)}else t=unescape(i);return t},U=function(i,l){return i.indexOf(l)>-1},V=function(i,l){i[i[x]]=l},W=function(i){return i.toLowerCase()},X=function(i,l){return i.split(l)},fa=function(i,l){return i.indexOf(l)},O=function(i,l,g){g=w==g?i[x]:g;return i.substring(l,g)},ga=function(i,l){return i.join(l)},ia=function(i){var l=1,g=0,t;if(!N(i)){l=0;for(t=i[x]-1;t>=0;t--){g=
i.charCodeAt(t);l=(l<<6&268435455)+g+(g<<14);g=l&266338304;l=g!=0?l^g>>21:l}}return l},ja=function(){var i=window,l=w;if(i&&i.gaGlobal&&i.gaGlobal.hid)l=i.gaGlobal.hid;else{l=Y();i.gaGlobal=i.gaGlobal?i.gaGlobal:{};i.gaGlobal.hid=l}return l},Y=function(){return Math.round(Math.random()*2147483647)},Z={Ha:function(i,l){this.bb=i;this.nb=l},ib:v,_gasoDomain:w,_gasoCPath:w};Z.Gb=function(){function i(k){return new t(k[0],k[1])}function l(k){var p=[];k=k.split(",");var f;for(f=0;f<k.length;++f)p.push(i(k[f].split(":")));return p}var g=this,t=Z.Ha;g.Ia="utm_campaign";g.Ja="utm_content";g.Ka="utm_id";g.La="utm_medium";g.Ma="utm_nooverride";g.Na="utm_source";g.Oa="utm_term";g.Pa="gclid";g.ba=0;g.z=0;g.Ta=15768E6;g.sb=18E5;g.v=63072E6;g.ta=[];g.va=[];g.nc="cse";g.oc="q";g.ob=5;g.T=l("daum:q,eniro:search_word,naver:query,images.google:q,google:q,yahoo:p,msn:q,bing:q,aol:query,aol:encquery,lycos:query,ask:q,altavista:q,netscape:query,cnn:query,about:terms,mamma:query,alltheweb:q,voila:rdata,virgilio:qs,live:q,baidu:wd,alice:qs,yandex:text,najdi:q,aol:q,mama:query,seznam:q,search:q,wp:szukaj,onet:qt,szukacz:q,yam:k,pchome:q,kvasir:q,sesam:q,ozu:q,terra:query,mynet:q,ekolay:q,rambler:words");
g.t=w;g.lb=v;g.h="/";g.U=100;g.oa="/__utm.gif";g.ga=1;g.ha=1;g.u="|";g.fa=1;g.da=1;g.Ra=1;g.b="auto";g.I=1;g.ra=1E3;g.Jc=10;g.Pb=10;g.Kc=0.2;g.o=w;g.a=document;g.e=window};Z.Hb=function(i){function l(d,a,j,c){var n="",s=0;n=P(d,"2"+a,";");if(!N(n)){d=n.indexOf("^"+j+".");if(d<0)return["",0];n=O(n,d+j[x]+2);if(n.indexOf("^")>0)n=n.split("^")[0];j=n.split(":");n=j[1];s=parseInt(j[0],10);if(!c&&s<p.r)n=""}if(N(n))n="";return[n,s]}function g(d,a){return"^"+ga([[a,d[1]].join("."),d[0]],":")}function t(d,a){f.a[y]=d+"; path="+f.h+"; "+a+p.fb()}function k(d){var a=new Date;d=new Date(a.getTime()+d);return"expires="+d.toGMTString()+"; "}var p=this,f=i;p.r=(new Date).getTime();
var h=[D,E,G,J,H,K,L];p.k=function(){var d=f.a[y];return f.o?p.Wb(d,f.o):d};p.Wb=function(d,a){var j=[],c,n;for(c=0;c<h[x];c++){n=l(d,h[c],a)[0];N(n)||(j[j[x]]=h[c]+n+";")}return j.join("")};p.l=function(d,a,j){var c=j>0?k(j):"";if(f.o){a=p.kc(f.a[y],d,f.o,a,j);d="2"+d;c=j>0?k(f.v):""}t(d+a,c)};p.kc=function(d,a,j,c,n){var s="";n=n||f.v;c=g([c,p.r+n*1],j);s=P(d,"2"+a,";");if(!N(s)){d=g(l(d,a,j,r),j);s=ga(s.split(d),"");return s=c+s}return c};p.fb=function(){return N(f.b)?"":"domain="+f.b+";"}};Z.$=function(i){function l(b){b=b instanceof Array?b.join("."):"";return N(b)?"-":b}function g(b,e){var o=[];if(!N(b)){o=b.split(".");if(e)for(b=0;b<o[x];b++)Q(o[b])||(o[b]="-")}return o}function t(b,e,o){var m=c.M,q,u;for(q=0;q<m[x];q++){u=m[q][0];u+=N(e)?e:e+m[q][4];m[q][2](P(b,u,o))}}var k,p,f,h,d,a,j,c=this,n,s=i;c.j=new Z.Hb(i);c.kb=function(){return w==n||n==c.P()};c.k=function(){return c.j.k()};c.ma=function(){return d?d:"-"};c.vb=function(b){d=b};c.za=function(b){n=Q(b)?b*1:"-"};c.la=function(){return l(a)};
c.Aa=function(b){a=g(b)};c.Vb=function(){c.j.l(H,"",-1)};c.lc=function(){return n?n:"-"};c.fb=function(){return N(s.b)?"":"domain="+s.b+";"};c.ja=function(){return l(k)};c.tb=function(b){k=g(b,1)};c.C=function(){return l(p)};c.ya=function(b){p=g(b,1)};c.ka=function(){return l(f)};c.ub=function(b){f=g(b,1)};c.na=function(){return l(h)};c.wb=function(b){h=g(b);for(b=0;b<h[x];b++)if(b<4&&!Q(h[b]))h[b]="-"};c.fc=function(){return j};c.Dc=function(b){j=b};c.Sb=function(){k=[];p=[];f=[];h=[];d=w;a=[];n=
w};c.P=function(){var b="",e;for(e=0;e<c.M[x];e++)b+=c.M[e][1]();return ia(b)};c.ua=function(b){var e=c.k(),o=v;if(e){t(e,b,";");c.za(c.P());o=r}return o};c.zc=function(b){t(b,"",B);c.za(P(b,da,B))};c.Hc=function(){var b=c.M,e=[],o;for(o=0;o<b[x];o++)V(e,b[o][0]+b[o][1]());V(e,da+c.P());return e.join(B)};c.Nc=function(b,e){var o=c.M,m=s.h;c.ua(b);s.h=e;for(b=0;b<o[x];b++)N(o[b][1]())||o[b][3]();s.h=m};c.Cb=function(){c.j.l(D,c.ja(),s.v)};c.Ea=function(){c.j.l(E,c.C(),s.sb)};c.Db=function(){c.j.l(G,
c.ka(),0)};c.Ga=function(){c.j.l(J,c.na(),s.Ta)};c.Eb=function(){c.j.l(K,c.ma(),s.v)};c.Fa=function(){c.j.l(H,c.la(),s.v)};c.Oc=function(){c.j.l(L,c.fc(),0)};c.M=[[D,c.ja,c.tb,c.Cb,"."],[E,c.C,c.ya,c.Ea,""],[G,c.ka,c.ub,c.Db,""],[K,c.ma,c.vb,c.Eb,""],[J,c.na,c.wb,c.Ga,"."],[H,c.la,c.Aa,c.Fa,"."]]};Z.Kb=function(i){var l=this,g=i,t=new Z.$(g),k=function(){},p=function(f){var h=(new Date).getTime(),d;d=(h-f[3])*(g.Kc/1E3);if(d>=1){f[2]=Math.min(Math.floor(f[2]*1+d),g.Pb);f[3]=h}return f};l.H=function(f,h,d,a,j,c){var n,s=g.I,b=g.a[A];t.ua(d);n=X(t.C(),".");if(n[1]<500||a){if(j)n=p(n);if(a||!j||n[2]>=1){if(!a&&j)n[2]=n[2]*1-1;n[1]=n[1]*1+1;f="?utmwv="+ca+"&utmn="+Y()+(N(b.hostname)?"":"&utmhn="+S(b.hostname))+(g.U==100?"":"&utmsp="+S(g.U))+f;if(0==s||2==s){a=2==s?k:c||k;l.$a(g.oa+f,a)}if(1==s||
2==s){f=("https:"==b.protocol?"https://ssl.google-analytics.com/__utm.gif":"http://www.google-analytics.com/__utm.gif")+f+"&utmac="+h+"&utmcc="+l.ac(d);if(ka)f+="&gaq=1";l.$a(f,c)}}}t.ya(n.join("."));t.Ea()};l.$a=function(f,h){var d=new Image(1,1);d.src=f;d.onload=function(){d.onload=null;(h||k)()}};l.ac=function(f){var h=[],d=[D,J,H,K],a,j=t.k(),c;for(a=0;a<d[x];a++){c=P(j,d[a]+f,";");if(!N(c)){if(d[a]==H){c=X(c.split(f+".")[1],"|")[0];if(N(c))continue;c=f+"."+c}V(h,d[a]+c+";")}}return S(h.join("+"))}};Z.n=function(){var i=this;i.Y=[];i.hb=function(l){var g,t=i.Y,k;for(k=0;k<t.length;k++)g=l==t[k].q?t[k]:g;return g};i.Ob=function(l,g,t,k,p,f,h,d){var a=i.hb(l);if(w==a){a=new Z.n.Mb(l,g,t,k,p,f,h,d);V(i.Y,a)}else{a.Qa=g;a.Ab=t;a.zb=k;a.xb=p;a.Xa=f;a.yb=h;a.Za=d}return a}};Z.n.Lb=function(i,l,g,t,k,p){var f=this;f.Bb=i;f.Ba=l;f.D=g;f.Va=t;f.pb=k;f.qb=p;f.Ca=function(){return"&"+["utmt=item","tid="+S(f.Bb),"ipc="+S(f.Ba),"ipn="+S(f.D),"iva="+S(f.Va),"ipr="+S(f.pb),"iqt="+S(f.qb)].join("&utm")}};
Z.n.Mb=function(i,l,g,t,k,p,f,h){var d=this;d.q=i;d.Qa=l;d.Ab=g;d.zb=t;d.xb=k;d.Xa=p;d.yb=f;d.Za=h;d.R=[];d.Nb=function(a,j,c,n,s){var b=d.gc(a),e=d.q;if(w==b)V(d.R,new Z.n.Lb(e,a,j,c,n,s));else{b.Bb=e;b.Ba=a;b.D=j;b.Va=c;b.pb=n;b.qb=s}};d.gc=function(a){var j,c=d.R,n;for(n=0;n<c.length;n++)j=a==c[n].Ba?c[n]:j;return j};d.Ca=function(){return"&"+["utmt=tran","id="+S(d.q),"st="+S(d.Qa),"to="+S(d.Ab),"tx="+S(d.zb),"sp="+S(d.xb),"ci="+S(d.Xa),"rg="+S(d.yb),"co="+S(d.Za)].join("&utmt")}};Z.Fb=function(i){function l(){var f,h,d;h="ShockwaveFlash";var a="$version",j=k.d?k.d.plugins:w;if(j&&j[x]>0)for(f=0;f<j[x]&&!d;f++){h=j[f];if(U(h.name,"Shockwave Flash"))d=h.description.split("Shockwave Flash ")[1]}else{h=h+"."+h;try{f=new ActiveXObject(h+".7");d=f.GetVariable(a)}catch(c){}if(!d)try{f=new ActiveXObject(h+".6");d="WIN 6,0,21,0";f.AllowScriptAccess="always";d=f.GetVariable(a)}catch(n){}if(!d)try{f=new ActiveXObject(h);d=f.GetVariable(a)}catch(s){}if(d){d=X(d.split(" ")[1],",");d=d[0]+
"."+d[1]+" r"+d[2]}}return d?d:p}var g=i,t=g.e,k=this,p="-";k.V=t.screen;k.Sa=!k.V&&t.java?java.awt.Toolkit.getDefaultToolkit():w;k.d=t.navigator;k.W=p;k.xa=p;k.Wa=p;k.qa=p;k.pa=1;k.eb=p;k.bc=function(){var f;if(t.screen){k.W=k.V.width+"x"+k.V.height;k.xa=k.V.colorDepth+"-bit"}else if(k.Sa)try{f=k.Sa.getScreenSize();k.W=f.width+"x"+f.height}catch(h){}k.qa=W(k.d&&k.d.language?k.d.language:k.d&&k.d.browserLanguage?k.d.browserLanguage:p);k.pa=k.d&&k.d.javaEnabled()?1:0;k.eb=g.ha?l():p;k.Wa=S(g.a.characterSet?
g.a.characterSet:g.a.charset?g.a.charset:p)};k.Ic=function(){return B+"utm"+["cs="+S(k.Wa),"sr="+k.W,"sc="+k.xa,"ul="+k.qa,"je="+k.pa,"fl="+S(k.eb)].join("&utm")};k.$b=function(){var f=g.a,h=t.history[x];f=k.d.appName+k.d.version+k.qa+k.d.platform+k.d.userAgent+k.pa+k.W+k.xa+(f[y]?f[y]:"")+(f.referrer?f.referrer:"");for(var d=f[x];h>0;)f+=h--^d++;return ia(f)}};Z.m=function(i,l,g,t){function k(d){var a="";d=W(d.split("://")[1]);if(U(d,"/")){d=d.split("/")[1];if(U(d,"?"))a=d.split("?")[0]}return a}function p(d){var a="";a=W(d.split("://")[1]);if(U(a,"/"))a=a.split("/")[0];return a}var f=t,h=this;h.c=i;h.rb=l;h.r=g;h.ic=function(d){var a=h.gb();return new Z.m.w(P(d,f.Ka+C,B),P(d,f.Na+C,B),P(d,f.Pa+C,B),h.Q(d,f.Ia,"(not set)"),h.Q(d,f.La,"(not set)"),h.Q(d,f.Oa,a&&!N(a.K)?T(a.K):w),h.Q(d,f.Ja,w))};h.jb=function(d){var a=p(d),j=k(d);if(U(a,"google")){d=d.split("?").join(B);
if(U(d,B+f.oc+C))if(j==f.nc)return r}return v};h.gb=function(){var d,a=h.rb,j,c,n=f.T;if(!(N(a)||"0"==a||!U(a,"://")||h.jb(a))){d=p(a);for(j=0;j<n[x];j++){c=n[j];if(U(d,W(c.bb))){a=a.split("?").join(B);if(U(a,B+c.nb+C)){d=a.split(B+c.nb+C)[1];if(U(d,B))d=d.split(B)[0];return new Z.m.w(w,c.bb,w,"(organic)","organic",d,w)}}}}};h.Q=function(d,a,j){d=P(d,a+C,B);return j=!N(d)?T(d):!N(j)?j:"-"};h.uc=function(d){var a=f.ta,j=v,c;if(d&&"organic"==d.S){d=W(T(d.K));for(c=0;c<a[x];c++)j=j||W(a[c])==d}return j};
h.hc=function(){var d="",a="";d=h.rb;if(!(N(d)||"0"==d||!U(d,"://")||h.jb(d))){d=d.split("://")[1];if(U(d,"/")){a=O(d,d.indexOf("/"));a=a.split("?")[0];d=W(d.split("/")[0])}if(0==d.indexOf("www."))d=O(d,4);return new Z.m.w(w,d,w,"(referral)","referral",w,a)}};h.Xb=function(d){var a="";if(f.ba){a=d&&d.hash?d.href.substring(d.href.indexOf("#")):"";a=""!=a?a+B:a}a+=d.search;return a};h.dc=function(){return new Z.m.w(w,"(direct)",w,"(direct)","(none)",w,w)};h.vc=function(d){var a=v,j,c=f.va;if(d&&"referral"==
d.S){d=W(S(d.X));for(j=0;j<c[x];j++)a=a||U(d,W(c[j]))}return a};h.L=function(d){return w!=d&&d.mb()};h.cc=function(d,a){var j="",c="-",n,s=0,b,e,o=h.c;if(!d)return"";e=d.k();j=h.Xb(f.a[A]);if(f.z&&d.kb()){c=d.na();if(!N(c)&&!U(c,";")){d.Ga();return""}}c=P(e,J+o+".",";");n=h.ic(j);if(h.L(n)){j=P(j,f.Ma+C,B);if("1"==j&&!N(c))return""}if(!h.L(n)){n=h.gb();if(!N(c)&&h.uc(n))return""}if(!h.L(n)&&a){n=h.hc();if(!N(c)&&h.vc(n))return""}if(!h.L(n))if(N(c)&&a)n=h.dc();if(!h.L(n))return"";if(!N(c)){s=c.split(".");
b=new Z.m.w;b.Zb(s.slice(4).join("."));b=W(b.Da())==W(n.Da());s=s[3]*1}if(!b||a){a=P(e,D+o+".",";");e=a.lastIndexOf(".");a=e>9?O(a,e+1)*1:0;s++;a=0==a?1:a;d.wb([o,h.r,a,s,n.Da()].join("."));d.Ga();return B+"utmcn=1"}else return B+"utmcr=1"}};
Z.m.w=function(i,l,g,t,k,p,f){var h=this;h.q=i;h.X=l;h.ea=g;h.D=t;h.S=k;h.K=p;h.Ya=f;h.Da=function(){var d=[],a=[["cid",h.q],["csr",h.X],["gclid",h.ea],["ccn",h.D],["cmd",h.S],["ctr",h.K],["cct",h.Ya]],j,c;if(h.mb())for(j=0;j<a[x];j++)if(!N(a[j][1])){c=a[j][1].split("+").join("%20");c=c.split(" ").join("%20");V(d,"utm"+a[j][0]+C+c)}return d.join("|")};h.mb=function(){return!(N(h.q)&&N(h.X)&&N(h.ea))};h.Zb=function(d){var a=function(j){return T(P(d,"utm"+j+C,"|"))};h.q=a("cid");h.X=a("csr");h.ea=a("gclid");
h.D=a("ccn");h.S=a("cmd");h.K=a("ctr");h.Ya=a("cct")}};Z.Ib=function(i,l,g,t){function k(j,c,n){var s;if(!N(n)){n=n.split(",");for(var b=0;b<n[x];b++){s=n[b];if(!N(s)){s=s.split(h);if(s[x]==4)c[s[0]]=[s[1],s[2],j]}}}}var p=this,f=l,h=C,d=i,a=t;p.O=g;p.sa="";p.p={};p.tc=function(){var j;j=X(P(p.O.k(),H+f+".",";"),f+".")[1];if(!N(j)){j=j.split("|");k(1,p.p,j[1]);p.sa=j[0];p.Z()}};p.Z=function(){p.Qb();var j=p.sa,c,n,s="";for(c in p.p)if((n=p.p[c])&&1===n[2])s+=c+h+n[0]+h+n[1]+h+1+",";N(s)||(j+="|"+s);if(N(j))p.O.Vb();else{p.O.Aa(f+"."+j);p.O.Fa()}};p.Ec=
function(j){p.sa=j;p.Z()};p.Cc=function(j,c,n,s){if(1!=s&&2!=s&&3!=s)s=3;var b=v;if(c&&n&&j>0&&j<=d.ob){c=S(c);n=S(n);if(c[x]+n[x]<=64){p.p[j]=[c,n,s];p.Z();b=r}}return b};p.mc=function(j){if((j=p.p[j])&&1===j[2])return j[1]};p.Ub=function(j){var c=p.p;if(c[j]){delete c[j];p.Z()}};p.Qb=function(){a._clearKey(8);a._clearKey(9);a._clearKey(11);var j=p.p,c,n;for(n in j)if(c=j[n]){a._setKey(8,n,c[0]);a._setKey(9,n,c[1]);(c=c[2])&&3!=c&&a._setKey(11,n,""+c)}}};Z.N=function(){function i(m,q,u,z){if(w==f[m])f[m]={};if(w==f[m][q])f[m][q]=[];f[m][q][u]=z}function l(m,q){if(w!=f[m]&&w!=f[m][q]){f[m][q]=w;q=r;var u;for(u=0;u<a[x];u++)if(w!=f[m][a[u]]){q=v;break}if(q)f[m]=w}}function g(m){var q="",u=v,z,M;for(z=0;z<a[x];z++){M=m[a[z]];if(w!=M){if(u)q+=a[z];q+=t(M);u=v}else u=r}return q}function t(m){var q=[],u,z;for(z=0;z<m[x];z++)if(w!=m[z]){u="";if(z!=o&&w==m[z-1])u+=z.toString()+s;u+=k(m[z]);V(q,u)}return j+q.join(n)+c}function k(m){var q="",u,z,M;for(u=0;u<
m[x];u++){z=m.charAt(u);M=e[z];q+=w!=M?M:z}return q}var p=this,f={},h="k",d="v",a=[h,d],j="(",c=")",n="*",s="!",b="'",e={};e[b]="'0";e[c]="'1";e[n]="'2";e[s]="'3";var o=1;p.qc=function(m){return w!=f[m]};p.G=function(){var m="",q;for(q in f)if(w!=f[q])m+=q.toString()+g(f[q]);return m};p.Ac=function(m){if(m==w)return p.G();var q=m.G(),u;for(u in f)if(w!=f[u]&&!m.qc(u))q+=u.toString()+g(f[u]);return q};p._setKey=function(m,q,u){if(typeof u!="string")return v;i(m,h,q,u);return r};p._setValue=function(m,
q,u){if(typeof u!="number"&&(w==Number||!(u instanceof Number))||Math.round(u)!=u||u==NaN||u==Infinity)return v;i(m,d,q,u.toString());return r};p._getKey=function(m,q){return w!=f[m]&&w!=f[m][h]?f[m][h][q]:w};p._getValue=function(m,q){return w!=f[m]&&w!=f[m][d]?f[m][d][q]:w};p._clearKey=function(m){l(m,h)};p._clearValue=function(m){l(m,d)}};Z.Jb=function(i,l){var g=this;g.Qc=l;g.xc=i;g._trackEvent=function(t,k,p){return l._trackEvent(g.xc,t,k,p)}};Z.aa=function(i,l){function g(){if("auto"==c.b){var b=c.a.domain;if("www."==O(b,0,4))b=O(b,4);c.b=b}c.b=W(c.b)}function t(){var b=c.b,e=b.indexOf("www.google.")*b.indexOf(".google.")*b.indexOf("google.");return e||"/"!=c.h||b.indexOf("google.org")>-1}function k(b,e,o){if(N(b)||N(e)||N(o))return"-";b=P(b,D+a.c+".",e);if(!N(b)){b=b.split(".");b[5]=b[5]?b[5]*1+1:1;b[3]=b[4];b[4]=o;b=b.join(".")}return b}function p(){return"file:"!=c.a[A].protocol&&t()}function f(b){if(!b||""==b)return"";for(;ea(b.charAt(0));)b=
O(b,1);for(;ea(b.charAt(b[x]-1));)b=O(b,0,b[x]-1);return b}function h(b,e,o,m){if(!N(b())){e(m?T(b()):b());U(b(),";")||o()}}function d(b){var e,o=""!=b&&c.a[A].host!=b;if(o)for(e=0;e<c.t[x];e++)o=o&&fa(W(b),W(c.t[e]))==-1;return o}var a=this,j=w,c=new Z.Gb,n=v,s=w;a.e=window;a.r=Math.round((new Date).getTime()/1E3);a.s=i||"UA-XXXXX-X";a.ab=c.a.referrer;a.ia=w;a.f=w;a.B=w;a.F=v;a.A=w;a.Ua="";a.g=w;a.cb=w;a.c=w;a.i=w;c.o=l?S(l):w;a.wc=function(){var b=v;if(a.B)b=a.B.match(/^[0-9a-z-_.]{10,1200}$/i);
return b};a.jc=function(){return Y()^a.A.$b()&2147483647};a.ec=function(){if(!c.b||""==c.b||"none"==c.b){c.b="";return 1}g();return c.Ra?ia(c.b):1};a.Yb=function(b,e){if(N(b))b="-";else{e+=c.h&&"/"!=c.h?c.h:"";e=b.indexOf(e);b=e>=0&&e<=8?"0":"["==b.charAt(0)&&"]"==b.charAt(b[x]-1)?"-":b}return b};a.wa=function(b){var e="",o=c.a;e+=c.fa?a.A.Ic():"";e+=c.da?a.Ua:"";e+=c.ga&&!N(o.title)?"&utmdt="+S(o.title):"";e+="&utmhid="+ja()+"&utmr="+S(a.ia)+"&utmp="+S(a.Bc(b));return e};a.Bc=function(b){var e=c.a[A];
return b=w!=b&&""!=b?S(b,r):S(e.pathname+e.search,r)};a.Lc=function(b){if(a.J()){var e="";if(a.g!=w&&a.g.G()[x]>0)e+="&utme="+S(a.g.G());e+=a.wa(b);j.H(e,a.s,a.c)}};a.Tb=function(){var b=new Z.$(c);return b.ua(a.c)?b.Hc():w};a._getLinkerUrl=function(b,e){var o=b.split("#"),m=b,q=a.Tb();if(q)if(e&&1>=o[x])m+="#"+q;else if(!e||1>=o[x])if(1>=o[x])m+=(U(b,"?")?B:"?")+q;else m=o[0]+(U(b,"?")?B:"?")+q+"#"+o[1];return m};a.Fc=function(){var b;if(a.wc()){a.i.Dc(a.B);a.i.Oc();Z._gasoDomain=c.b;Z._gasoCPath=
c.h;b=c.a.createElement("script");b.type="text/javascript";b.id="_gasojs";b.src="https://www.google.com/analytics/reporting/overlay_js?gaso="+a.B+B+Y();c.a.getElementsByTagName("head")[0].appendChild(b)}};a.pc=function(){var b=a.r,e=a.i,o=e.k(),m=a.c+"",q=c.e,u=q?q.gaGlobal:w,z,M=U(o,D+m+"."),la=U(o,E+m),ma=U(o,G+m),F,I=[],R="",ha=v;o=N(o)?"":o;if(c.z){z=c.a[A]&&c.a[A].hash?c.a[A].href.substring(c.a[A].href.indexOf("#")):"";if(c.ba&&!N(z))R=z+B;R+=c.a[A].search;if(!N(R)&&U(R,D)){e.zc(R);e.kb()||e.Sb();
F=e.ja()}h(e.ma,e.vb,e.Eb,true);h(e.la,e.Aa,e.Fa)}if(N(F))if(M)if(!la||!ma){F=k(o,";",b);a.F=r}else{F=P(o,D+m+".",";");I=X(P(o,E+m,";"),".")}else{F=ga([m,a.jc(),b,b,b,1],".");ha=a.F=r}else if(N(e.C())||N(e.ka())){F=k(R,B,b);a.F=r}else{I=X(e.C(),".");m=I[0]}F=F.split(".");if(q&&u&&u.dh==m&&!c.o){F[4]=u.sid?u.sid:F[4];if(ha){F[3]=u.sid?u.sid:F[4];if(u.vid){b=u.vid.split(".");F[1]=b[0];F[2]=b[1]}}}e.tb(F.join("."));I[0]=m;I[1]=I[1]?I[1]:0;I[2]=w!=I[2]?I[2]:c.Jc;I[3]=I[3]?I[3]:F[4];e.ya(I.join("."));
e.ub(m);N(e.lc())||e.za(e.P());e.Cb();e.Ea();e.Db()};a.rc=function(){j=new Z.Kb(c)};a._initData=function(){var b;if(!n){if(!a.A){a.A=new Z.Fb(c);a.A.bc()}a.c=a.ec();a.i=new Z.$(c);a.g=new Z.N;s=new Z.Ib(c,a.c,a.i,a.g);a.rc()}if(p()){a.pc();s.tc()}if(!n){if(p()){a.ia=a.Yb(a.ab,c.a.domain);if(c.da){b=new Z.m(a.c,a.ia,a.r,c);a.Ua=b.cc(a.i,a.F)}}a.cb=new Z.N;n=r}Z.ib||a.sc()};a._visitCode=function(){a._initData();var b=P(a.i.k(),D+a.c+".",";");b=b.split(".");return b[x]<4?"":b[1]};a._cookiePathCopy=function(b){a._initData();
a.i&&a.i.Nc(a.c,b)};a.sc=function(){var b=c.a[A].hash;if(b&&1==b.indexOf("gaso="))b=P(b,"gaso=",B);else b=(b=c.e.name)&&0<=b.indexOf("gaso=")?P(b,"gaso=",B):P(a.i.k(),L,";");if(b[x]>=10){a.B=b;a.Fc()}Z.ib=r};a.J=function(){return a._visitCode()%1E4<c.U*100};a.Gc=function(){var b,e,o=c.a.links;if(!c.lb){b=c.a.domain;if("www."==O(b,0,4))b=O(b,4);c.t.push("."+b)}for(b=0;b<o[x]&&(c.ra==-1||b<c.ra);b++){e=o[b];if(d(e.host))if(!e.gatcOnclick){e.gatcOnclick=e.onclick?e.onclick:a.yc;e.onclick=function(m){var q=
!this.target||this.target=="_self"||this.target=="_top"||this.target=="_parent";q=q&&!a.Rb(m);a.Mc(m,this,q);return q?v:this.gatcOnclick?this.gatcOnclick(m):r}}}};a.yc=function(){};a._trackPageview=function(b){if(p()){a._initData();c.t&&a.Gc();a.Lc(b);a.F=v}};a._trackTrans=function(){var b=a.c,e=[],o,m,q;a._initData();if(a.f&&a.J()){for(o=0;o<a.f.Y[x];o++){m=a.f.Y[o];V(e,m.Ca());for(q=0;q<m.R[x];q++)V(e,m.R[q].Ca())}for(o=0;o<e[x];o++)j.H(e[o],a.s,b,r)}};a._setTrans=function(){var b=c.a,e,o,m;b=b.getElementById?
b.getElementById("utmtrans"):b.utmform&&b.utmform.utmtrans?b.utmform.utmtrans:w;a._initData();if(b&&b.value){a.f=new Z.n;m=b.value.split("UTM:");c.u=!c.u||""==c.u?"|":c.u;for(b=0;b<m[x];b++){m[b]=f(m[b]);e=m[b].split(c.u);for(o=0;o<e[x];o++)e[o]=f(e[o]);if("T"==e[0])a._addTrans(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]);else"I"==e[0]&&a._addItem(e[1],e[2],e[3],e[4],e[5],e[6])}}};a._addTrans=function(b,e,o,m,q,u,z,M){a.f=a.f?a.f:new Z.n;return a.f.Ob(b,e,o,m,q,u,z,M)};a._addItem=function(b,e,o,m,q,u){var z;
a.f=a.f?a.f:new Z.n;(z=a.f.hb(b))||(z=a._addTrans(b,"","","","","","",""));z.Nb(e,o,m,q,u)};a._setVar=function(b){if(b&&""!=b&&t()){a._initData();s.Ec(S(b));a.J()&&j.H("&utmt=var",a.s,a.c)}};a._setCustomVar=function(b,e,o,m){a._initData();return s.Cc(b,e,o,m)};a._deleteCustomVar=function(b){a._initData();s.Ub(b)};a._getVisitorCustomVar=function(b){a._initData();return s.mc(b)};a._setMaxCustomVariables=function(b){c.ob=b};a._link=function(b,e){if(c.z&&b){a._initData();c.a[A].href=a._getLinkerUrl(b,
e)}};a._linkByPost=function(b,e){if(c.z&&b&&b.action){a._initData();b.action=a._getLinkerUrl(b.action,e)}};a._setXKey=function(b,e,o){a.g._setKey(b,e,o)};a._setXValue=function(b,e,o){a.g._setValue(b,e,o)};a._getXKey=function(b,e){return a.g._getKey(b,e)};a._getXValue=function(b,e){return a.g.getValue(b,e)};a._clearXKey=function(b){a.g._clearKey(b)};a._clearXValue=function(b){a.g._clearValue(b)};a._createXObj=function(){a._initData();return new Z.N};a._sendXEvent=function(b){var e="";a._initData();
if(a.J()){e+="&utmt=event&utme="+S(a.g.Ac(b))+a.wa();j.H(e,a.s,a.c,v,r)}};a._createEventTracker=function(b){a._initData();return new Z.Jb(b,a)};a._trackEvent=function(b,e,o,m){var q=a.cb;if(w!=b&&w!=e&&""!=b&&""!=e){q._clearKey(5);q._clearValue(5);(b=q._setKey(5,1,b)&&q._setKey(5,2,e)&&(w==o||q._setKey(5,3,o))&&(w==m||q._setValue(5,1,m)))&&a._sendXEvent(q)}else b=v;return b};a.Mc=function(b,e,o){a._initData();if(a.J()){var m=new Z.N;m._setKey(6,1,e.href);var q=o?function(){a.db(b,e)}:w;j.H("&utmt=event&utme="+
S(m.G())+a.wa(),a.s,a.c,v,r,q);if(o){var u=this;c.e.setTimeout(function(){u.db(b,e)},500)}}};a.db=function(b,e){if(!b)b=c.e.event;var o=r;if(e.gatcOnclick)o=e.gatcOnclick(b);if(o||typeof o=="undefined")if(!e.target||e.target=="_self")c.e[A]=e.href;else if(e.target=="_top")c.e.top.document[A]=e.href;else if(e.target=="_parent")c.e.parent.document[A]=e.href};a.Rb=function(b){if(!b)b=c.e.event;var e=b.shiftKey||b.ctrlKey||b.altKey;if(!e)if(b.modifiers&&c.e.Event)e=b.modifiers&c.e.Event.CONTROL_MASK||
b.modifiers&c.e.Event.SHIFT_MASK||b.modifiers&c.e.Event.ALT_MASK;return e};a.Pc=function(){return c};a._setDomainName=function(b){c.b=b};a._addOrganic=function(b,e,o){c.T.splice(o?0:c.T.length,0,new Z.Ha(b,e))};a._clearOrganic=function(){c.T=[]};a._addIgnoredOrganic=function(b){V(c.ta,b)};a._clearIgnoredOrganic=function(){c.ta=[]};a._addIgnoredRef=function(b){V(c.va,b)};a._clearIgnoredRef=function(){c.va=[]};a._setAllowHash=function(b){c.Ra=b?1:0};a._setCampaignTrack=function(b){c.da=b?1:0};a._setClientInfo=
function(b){c.fa=b?1:0};a._getClientInfo=function(){return c.fa};a._setCookiePath=function(b){c.h=b};a._setTransactionDelim=function(b){c.u=b};a._setCookieTimeout=function(b){a._setCampaignCookieTimeout(b*1E3)};a._setCampaignCookieTimeout=function(b){c.Ta=b};a._setDetectFlash=function(b){c.ha=b?1:0};a._getDetectFlash=function(){return c.ha};a._setDetectTitle=function(b){c.ga=b?1:0};a._getDetectTitle=function(){return c.ga};a._setLocalGifPath=function(b){c.oa=b};a._getLocalGifPath=function(){return c.oa};
a._setLocalServerMode=function(){c.I=0};a._setRemoteServerMode=function(){c.I=1};a._setLocalRemoteServerMode=function(){c.I=2};a._getServiceMode=function(){return c.I};a._setSampleRate=function(b){c.U=b};a._setSessionTimeout=function(b){a._setSessionCookieTimeout(b*1E3)};a._setSessionCookieTimeout=function(b){c.sb=b};a._setAllowLinker=function(b){c.z=b?1:0};a._setAllowAnchor=function(b){c.ba=b?1:0};a._setCampNameKey=function(b){c.Ia=b};a._setCampContentKey=function(b){c.Ja=b};a._setCampIdKey=function(b){c.Ka=
b};a._setCampMediumKey=function(b){c.La=b};a._setCampNOKey=function(b){c.Ma=b};a._setCampSourceKey=function(b){c.Na=b};a._setCampTermKey=function(b){c.Oa=b};a._setCampCIdKey=function(b){c.Pa=b};a._getAccount=function(){return a.s};a._setAccount=function(b){a.s=b};a._setNamespace=function(b){c.o=b?S(b):w};a._getVersion=function(){return ca};a._setAutoTrackOutbound=function(b){c.t=[];if(b)c.t=b};a._setTrackOutboundSubdomains=function(b){c.lb=b};a._setHrefExamineLimit=function(b){c.ra=b};a._setReferrerOverride=
function(b){a.ab=b};a._setCookiePersistence=function(b){a._setVisitorCookieTimeout(b)};a._setVisitorCookieTimeout=function(b){c.v=b}};Z._getTracker=function(i,l){return new Z.aa(i,l)};var ka=v,$={ca:{},_createAsyncTracker:function(i,l){l=l||"";i=new Z.aa(i);$.ca[l]=i;ka=r;return i},_getAsyncTracker:function(i){i=i||"";var l=$.ca[i];if(!l){l=new Z.aa;$.ca[i]=l;ka=r}return l},push:function(){for(var i=arguments,l=0,g=0;g<i[x];g++)try{if(typeof i[g]==="function")i[g]();else{var t="",k=i[g][0],p=k.lastIndexOf(".");if(p>0){t=O(k,0,p);k=O(k,p+1)}var f=$._getAsyncTracker(t);f[k].apply(f,i[g].slice(1))}}catch(h){l++}return l}};window[aa]=Z;function na(){var i=window[ba],l=v;if(i&&typeof i.push=="function"){l=i.constructor==Array;if(!l)return}window[ba]=$;l&&$.push.apply($,i)}na();})()
			var pageTracker = _gat._getTracker("UA-11168512-1");
			pageTracker._setDomainName(".tapulous.com");
			$(document).bind("viewchange",function(e,view,subview,param) {
				var basePath = 	document.location.pathname;
				var path = basePath + view;
				if (subview) {
					path = path + "/" + subview;
				}
				if (param) {
					path = path + "/" + param;
				}
				pageTracker._trackPageview(path);

			});
			</script>

	</head>
	<body>
	<div class='loading'>
		<img src='../common/images/spinner.png' class='spin loadSpinner' />
	</div>

		<style>
		/* Header */
#header {
	background-color: rgba(255,255,255,0.1);
	padding: 4px;
	border-top: 1px solid #6B768A;
	text-align: right;
	min-height: 19px;
	outline: 1px solid #000;
	text-shadow: 0px -1px 0px rgba(0,0,0,0.8);
	font-weight: bold;
}


/* Lists */
li {
	list-style-type: none;
	margin: 0px;
	padding: 5px 10px;
	border-bottom: 1px solid rgba(0,0,0,0.8);
	border-top: 1px solid rgba(255,255,255,0.1);
	background-image: url(../common/images/chevron.png);
	background-position: center right;
	background-repeat: no-repeat;
}
.buy {
	background-color: rgba(203,234,147,0.1);
	-webkit-animation: subtle-hint 3s linear infinite alternate;	
}
@-webkit-keyframes 'subtle-hint' {
  0% {  color: rgb(255,255,255); background-color: rgba(203,234,147,0.1); } 
  100% {  color: rgb(203,234,147); background-color: rgba(255,255,255,0.1); } 
}
li.nochevron {
	background-image: none !important;
}
.intermediate_header {
	margin: 8px 4px;
	font-weight: bold;
	text-shadow: 0px -1px 0px #000;
	padding: 4px;
}
.intermediate_list {
	margin: 8px 4px;
}
.intermediate_list li {
	padding: 12px 8px;
	background-color: rgba(71%,76%,87%,0.1);
	font-weight: bold;
	text-shadow: 0px -1px 0px #000;
}
.intermediate_list li.question {
	background-color:rgba(110,148,194,0.2);
	
	padding: 3px 8px;
}

li:first-child {
	border-top: none;
}
.intermediate_list li:first-child {
	-webkit-border-top-right-radius: 8px;
	-webkit-border-top-left-radius: 8px;	
}
.intermediate_list li.not_first {
	-webkit-border-top-right-radius: 0px;
	-webkit-border-top-left-radius: 0px;	
}

li:last-child {
	border-bottom: none;
}
.intermediate_list li:last-child {
	-webkit-border-bottom-right-radius: 8px;
	-webkit-border-bottom-left-radius: 8px;
}
.intermediate_list li.attention {
	background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(98%,98%,98%,0.3)),to(rgba(71%,76%,87%,0.3))) !important;
	color: rgba(0,0,0,0.9) !important;
	text-shadow: 0px 1px 0px rgba(255,255,255,0.3) !important;
}

.intermediate_list li.attention .free-title { color:#000; }
.intermediate_list li.attention .free-subtitle{ color:#000;font:Helvetica;font-size:13px;margin-top:2px; }

.intermediate_list li.left_tab {
	float:left;
	width:139px;
	-webkit-border-top-right-radius: 0px;
	-webkit-border-top-left-radius: 8px;
	text-align:center;
	
	border-right:1px solid #323b40;
	background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(98%,98%,98%,0.3)),to(rgba(71%,76%,87%,0.3))) !important;
	opacity:0.5;
}
.intermediate_list li.right_tab {
	float:left;
	width:139px;
	-webkit-border-top-right-radius: 8px;
	-webkit-border-top-left-radius: 0px;
	-webkit-border-bottom-right-radius: 0px;
	-webkit-border-bottom-left-radius: 0px;
	margin-top:0px;
	text-align:center;
	
	border-left:1px solid #85939c;
	border-top:none;
	background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(98%,98%,98%,0.3)),to(rgba(71%,76%,87%,0.3))) !important;
	opacity:0.5;
}

.intermediate_list li.selected {
	opacity:1.0;
} 

.attention .tip {
	color:#fff; 
	text-shadow: 0px 1px 0px rgba(0,0,0,1.0) !important;
	font-size:11px; 
	padding-top:3px; 
	float:right;
}
.subline {
	margin-top:2px;
}

.padded {
	padding: 4px;
	width:312px;
}

/* Featured Page */
.featured {
	background-color: rgba(0,0,0,0.2);
	-webkit-border-radius: 8px;
	-webkit-box-sizing: border-box;
}
.sub_feature {
	float: left;
	width: 154px;
	height: 118px;
	-webkit-border-radius: 8px;
	-webkit-background-size: 100%;
	background-color: rgba(0,0,0,0.2);
}
.sub_feature:first-child {
	margin-right: 4px;
}
.featured_items_small {
	padding: 8px;
	padding-left: 12px;
}
.featured_items_small div {
	margin: 4px;
	width: 140px;
	height: 110px;
	background-color: rgba(0,0,0,0.2);
	-webkit-border-radius: 8px;
	-webkit-box-sizing: border-box;
	float: left;
}
.featured_header {
	-webkit-border-top-left-radius: 8px;
	-webkit-border-top-right-radius: 8px;
	border-bottom: 1px solid #000;
	background: -webkit-gradient(linear,left top, left bottom, from(#555555), to(#000000));
	padding: 8px;
	text-align: center;
	color: #FFFFFF;
	text-shadow: 0px -1px 0px rgba(0,0,0,0.8);
}
.featured_subheader {
	width: 312px;
	height: 19px;
	text-align: center;
	font-size: smaller;
	-webkit-box-sizing: border-box;
	color: #fff;
	text-shadow: 0px 1px 0px rgba(0,0,0,0.4);
	background-image: url(images/featured/featureSubheader.png);
}
.featured_track {
	background-color: rgba(0,0,0,0.2);
	width:312px;
	height: 157px;
	-webkit-border-top-left-radius: 8px;
	-webkit-border-top-right-radius: 8px;
}
.featured_buttons {
	background: -webkit-gradient(linear,left top, left bottom, from(#979da9), color-stop(0.5,#626c7d), color-stop(0.5,#505a6d), to(#323e54));
	border-top: 1px solid #c2c6cc;
	width: 312px;
	-webkit-box-shadow: 0px 1px 0px #000;
	-webkit-border-bottom-left-radius: 8px;
	-webkit-border-bottom-right-radius: 8px;
}
.featured_buttons div {
	float: left;
	border-right: 1px solid rgba(20%,24%,30%,0.4);
	border-left: 1px solid rgba(39%,43%,49%,0.4);
	width: 33%;
	padding: 12px 4px;
	-webkit-box-sizing: border-box;
	font-size: smaller;
	text-shadow: 0px 1px 1px #000;
	text-align: center;
}
.featured_buttons div:first-child {
	border-left: none !important;
}
.featured_buttons div:last-child {
	border-right: none !important;
}
.featured_buttons div img {
	float: left;
}
.featured_list {
	border: 1px solid #232527;
	border-top: 0px;
	-webkit-border-bottom-left-radius: 8px;
	-webkit-border-bottom-right-radius: 8px;
}
.featured_list li {
	background-color: #1b1d1f;
}
.featured_list li:last-child {
	-webkit-border-bottom-left-radius: 8px;
	-webkit-border-bottom-right-radius: 8px;
}


/* Text for the store items */
.title {
	font-weight: bold;
	font-size: 17px;
	color: #fff;
	text-shadow: 0px -1px 0px #000;
}
.highlight {
	color:#ebea5e;
}
.sm_font {
	font-size:13px;
	line-height:17px;
}
.very_sm_font {
	font-size:11px;
	line-height:15px;
}

.subtitle {
	font-size: 15px;
	color: #bbb;
	font-weight: bold !important;
	text-shadow: 0px -1px 0px rgba(0,0,0,0.7);
}
.description {
	font-size: 12px;
	margin-top: 10px;
	color: #fff;
	text-shadow: 0px -1px 0px rgba(0,0,0,0.8);
}
.purchased[purchased="0"] {
	display: none;
}
.purchased[purchased="1"] {
	font-size: smaller;
	opacity: 0.3;
}
li[locked="1"] {
	background-image:url('../images/lock.png');
	background-position: 289px center;
}
li[locked="0"] {
	background-image:none;
}
.locked[locked="0"] {
	display: none;
}
.locked[locked="1"] {
	padding-top:2px;
}
.locked .lock_text {
	font-size: smaller;
	opacity: 0.3;
}
.locked .lock_img {
	float:left;
	padding-right:3px;
}


/* Images */
.image {
	float: left;
	width: 64px;
	height: 64px;
	margin-right: 10px;
	background-color: rgba(0,0,0,0.7);
	-webkit-background-size: 64px;
	background-position: center center;
	overflow: hidden;
}
.thumb {
	background-color: rgba(0,0,0,0.2);
	-webkit-background-size: 40px;
	 width: 40px;
	 height: 40px;
	 -webkit-border-radius: 4px;
	 float: left;
	 margin-right: 8px;
}

.premium_thumb {
	background-color: rgba(0,0,0,0.2);
	-webkit-background-size: 50px;
	 width: 50px;
	 height: 50px;
	 -webkit-border-radius: 8px;
	 float: left;
	 margin-right: 8px;
}
.store_title {
	padding: 4px;
	background-color: rgba(22,22,22,0.4);
}

/* Avatar thumbnails */
.avatar_store {
	width: 142px;
	height: 112px;
	padding: 1px;
	border: 4px solid transparent;
	-webkit-border-radius: 16px;
	display: block;
	float: left;
	margin: 1px;
	background-color: rgba(0,0,0,0.1);
}
.avatar_store.hover {
	border: 4px solid #fff;
	opacity: 0.9;
}
.avatar_thumb {
	 float: left; margin-right: 15px; margin-bottom: 13px; -webkit-border-radius: 4px;
	 background-repeat: no-repeat;
	 font-size: smaller;
	 text-align: center;
	 color: #B6CDE8;
	 text-shadow: 1px 1px 0px rgba(0,0,0,0.5);
}
.avatar_thumb div {
	width: 50px;
	height: 50px;
	margin-bottom: 2px;
	background-color: rgba(0,0,0,0.4);
	-webkit-border-radius: 4px;
	background-repeat: no-repeat;
	-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,1);
}
.avatar_thumb:nth-child(5n) {
	margin-right: 0px;
}
.avatar_thumb:nth-child(-n+5) {
	margin-top: 8px;
}

/* List Items */
.item_song .content, .item_item .content {
	float: left;
	max-width: 220px;
	width: 220px;
}
.item_song .price {
	position: relative;
}
.item_container {
	padding: 4px;
}
.single {
	padding: 12px 8px;
	background-color: rgba(255,255,255,0.1);
	font-weight: bold;
	text-shadow: 0px -1px 0px #000;
	-webkit-border-radius: 8px;
	margin: 8px 4px;
}


.search-container {
	border-bottom: 1px solid rgba(255,255,255,0.1);
}
.search-area {
	background: -webkit-gradient(linear, left top, left bottom, from(#404d66), color-stop(0.01, #404d66), color-stop(0.5,#323B4C), color-stop(0.5,#293140), to(#282F3D)) !important;
	padding: 4px;
	padding-bottom: 2px;
	border-bottom: 1px solid rgba(0,0,0,0.8);
	border-top: 1px solid rgba(255,255,255,0.2);
}
.search-box {
	background-image: url(../images/spy.gif);
	background-repeat: no-repeat;
	background-position: 8px 8px;
	margin: 0px;
	margin-bottom: 2px;
	-webkit-border-radius: 12px !important;
	color: rgba(0,0,0,0.8);
	text-shadow: 0px 1px 0px #fff;
	width: 312px;
	padding: 4px;
	padding-left: 24px;
	border-top: 1px solid #000;
	-webkit-box-sizing: border-box;
}

/*  Channels */
.channel {
	background-image:none;
	background-repeat: no-repeat;
	background-position: 0 0;
	background-color: transparent;
	width:65px;
	height:65px;
	-webkit-border-radius: 8px;
	
}



#offerpal-notify-pref { padding-top:10px; font-size:13px; }
#offerpal-notify-pref LABEL {  position:relative; top:-2px; left:2px;  font-size:13px; color:#e4e376;	}

#offers_desc #offers-info { font-size:13px; text-align:justify; }
	</style>
	<script>
		/**
 * Tapulous Store JS Object
 * This code handles the store in Tap Tap Revenge III
 * Uses /api for all ajax communication with the server
 *
 * Created by Zach Allia <z@tapulous.com>
 * Requires jQuery (Included in the TTR bundle)
 * Requires Views.js and Zach's jQuery Templating (the latter is included in the app bundle)
 *
 */

Store = {
	items : {},
	ajax : false,
	cache : {details:{},items:{},tracks:{},packages:{},channels:{}},
	resetCache: function() { Store.cache = {details:{},items:{},tracks:{},packages:{},channels:{}} },
	coins: "-",
	credits: "-",
	showCampaign: 0,
	featuredCache: {},
	isDemoUser: function(){
		// any purchases or redemptions are banned for demo user
		if( Store.session.device_id == "ead614a44ecda996c6e67111d6276827ead614a44ecda996c6e67111d627682709b90e8dd9f190976ef3243a1f407960" ){
		  return true;
		} else {
		  return false;
		}
	}, 
	init: function(session) {
		/* Store the user to identify on the server */
	    Store.session = session;
	    
	    /* Setup event listeners */
	    Store.setupListeners();
	    
	    Store.initiateSession();
	    
	    /* Setup Views object */
	    Views.init("#container");
	    setTimeout(function() { if(!window.location.hash) { Views.resetWith("tracks/featured"); } },2000);
			
		// Check for stats
		var statIndex = window.location.hash.indexOf('tapstat');
		if (statIndex >= 0) {
			var statInfo = window.location.hash.substring(statIndex+8);
			Store.tapStat(statInfo);
			window.location.hash = window.location.hash.split('/tapstat')[0];
		}
		
		Views.app("get/key=pricing_info&callback=Prices.init");

	},
	setupListeners: function() {
		$(".avatar_store").livequery("touchstart",function() {
			$(this).addClass("hover");
		}).livequery("touchend",function() {
			$(this).removeClass("hover");
		}).livequery("touchcancel",function() {
			$(this).removeClass("hover");
		});
		/* When the view is changed, see if we should do anything about it */
		$(document).bind("viewchange",function(e,view,subview,param,param2) {

				//			clog(e+" "+view+" "+subview+" "+param+" "+param2);
				
			$("#container").css("background-image","none");
			Views.loading();
			
			// disable the store
			/*if (Store.session.device_id != "50aa6bbe78dabdad672d1886957b45ceeabb1ff4b9982178853308846f375387999f7be1a101e05bb34a81b1dfae0eed"
				&& Store.session.device_id != "922bdcef2b471efe781897165cb52c09e364438633cd7ae0b57491144a2da77b636805bee750bb96c5530dafe16c1dc1"
				&& Store.session.device_id != "42f788cfc67035d03decef7aa56d6fb64fb5c5ed3f1d35a3d16208223b22672aa2b9b51411b6413e490a287cbbf71d44") {
				Views.show('StoreDown'); 
		    	return;
		    }*/

			switch(view) {
				/* Items view tree */
				case "items":
					switch(subview) {
						case "detail":
							Store.detail(param,"item");
						break;
						case "filter":
							Store.items(param);
						break;
						case "store":
							Store.itemStore(param);
						break;
						case "browse":
							Views.show("items_stores", {"onload" : function() { Store.showCreditLine(); }});
						break;
						
						default:
							Store.getFeaturedAvatars();
							Store.getTopItems('exclusive');
					}
				break;
				case "offers":
					Store.offers();
				break;
				/* Tracks view tree */
				case "tracks":
					switch(subview) {
						case "free":
							Views.show("tracks_free",{"onload" : function() {Store.showCreditLine(); }});
						break;
						case "downloadfree":
							Store.downloadAllFree(param);
						break;
						case "detail":
							Store.detail(param,"track");
						break;
						case "package":
							Store.detail(param,"package");
						break;
						case "filter":
								Store.tracks(param,param2);
						break;
						case "packages":
							Store.packages();
						break;
						case "albums":
							Store.albums();
						break;
						case "difficulties":
						case "genres":
							Views.show("tracks_" + subview,{"onload" : function() { Store.showCreditLine(); }});
						break;
						case "browse":
							Views.show("tracks_browse",{"onload" : function() { Store.showCreditLine(); }});
						break;
						case "games":
							if (param == 1) { Store.games(true); return; }
							if(param) { Store.gameDetail(param); return; }
							Store.games();
						break;
						case "premiumGames":
							Store.premiumGames();
						break;
						case "channels":
							if (param2) {
								Store.getChannelTrack(param2);
							} else if (param) {
								Store.getChannel(param);
							} else {
								Views.show("channels",{"onload" : function() { Store.showCreditLine(); }});
							}
						break;
						default:
							Store.getFeatured();
							Store.getTopChart('paid');
						break;
					}
				break;
			}
		});
	},
	getTopItems: function(type) {
		if (type == 'top') {
			var apiName = "featured.getTopTenItems";
			var divID = "#top_ten";
		} else if (type == 'exclusive') {
			var apiName = "featured.getExclusiveItems";
			var divID = "#exclusive";
		} else {
			var apiName = "featured.getNewItems";
			var divID = "#top_new";
		}
		
		Store.api(apiName,function(data) {
			var str = [];
			for(item in data.content) {					
				var url= "Views.change(\"items/detail/"+data.content[item]['id']+"\")";
				str.push("<li class='clearfix' onclick='"+url+"'>",
						 '<div class="thumb" style="background-image:url(' + data.content[item]['image'] + ')"></div>',
						 '<div class="content clearfix">',
						   	'<div class="title ellipsis">' + data.content[item]['title'] + '</div>',
					    	'<div class="subtitle ellipsis">' + data.content[item]['subtitle'] + '</div>',
						   '</div>',
						 '</li>');
			}
			if(str.length) { $(divID).html(str.join('')); }
		});
	},
	getFeatured: function() {
		Views.show("TracksFeatured",{"onload": function() { Store.showCreditLine(); } });
	},
	getFeaturedAvatars: function() {
		Views.show("ItemsFeatured",{"onload": function() { Store.showCreditLine(); } });
	},
	getTopChart: function(type) {
		if (type == 'free') {
			var apiName = "featured.getTopFree";
			var divID = "#top_free";
		} else {
			var apiName = "featured.getTopPaid";
			var divID = "#top_paid";
		}
		
		Store.api(apiName,function(data) {
			var str = [];
			var itemCount = 0;
			for(item in data.content) {
					var url = (apiName == 'featured.getTopPaid') ? "Views.change(\"" + data.content[item]['url'].replace('ttr3cmd://store/','') + "\")" : "window.location.href = \"" + data.content[item]['url'] + "\"";
					var style = "";
					if (itemCount++ >= 10) {
						style = "display: none;";
					}
					var classes = "clearfix";
					str.push("<li class='clearfix' style='" + style + "' onclick='" + url + "'>",
							 '<div class="thumb" style="background-image:url(' + data.content[item]['image'] + ')"></div>',
							 '<div class="content clearfix">',
							   	'<div class="title ellipsis">' + data.content[item]['title'] + '</div>',
						    	'<div class="subtitle ellipsis">' + data.content[item]['subtitle'] + '</div>',
							   '</div>',
							 '</li>');
			}
			var backID = divID + "_back";
			str.push("<li id='" + backID.replace("#","")  + "' class='clearfix more' onclick=\"$('" + divID + " li').show(); $('" + backID +  "').hide(); \">More</li>");
			if(str.length) { $(divID).html(str.join('')); }
		});
	},
	getTrack: function(id, locked, locked_text) {
		if (locked == 1) {
			Views.alert(locked_text, "Locked Track");
		} else {
			Views.change('tracks/detail/'+id);
		}
	},
	games: function(showGamesOnly) {

		var offersTemplateOnloadFn = function() {
			$("#offerpal-pref").checked = (obj.offerpal_notify) ? true : false;
			
			Store.showCreditLine();
			if (showGamesOnly) {
				$('#offers_desc').hide();
				$('#installs_list').hide();
			}
			if (Store.cache.games.showCampaign != "0") {
				$('#showCampaign').show();
				$('#showCampaign').html(Store.cache.games.showCampaign);
			}
		}

		if(Store.cache.games) { 
			var gamesCache = Store.cache.games;
			var obj = {"apps":gamesCache.apps, "offers":gamesCache.offers, "installs":gamesCache.installs, "installs_premium":gamesCache.installs_premium, "offerpal_notify":gamesCache.offerpal_notify};
			Views.show("offers",{"data":obj,"onload":offersTemplateOnloadFn});
			return; 
		} else {
			// get the data and then call this same function again
			Store.api("games.get", function(data) {
					Store.cache.games = data.content;
					Store.games( showGamesOnly );
				});
		}
	},
	tapStat: function(tapInfo) {
		Store.api("save.stat", {"tapInfo": tapInfo});
	},
	premiumGames: function() {
		Store.api("games.get", function(data) {
			obj = {"apps":data.content.apps};
			Views.show("games",{"data":obj,"onload" : function() { Store.showCreditLine(); }});
		});
	},
	offerDetail: function(type, id, html) {
		if (type == 2) {
			obj = Store.cache.games.offers[id];
		} else if (type == 3) {
			obj = Store.cache.games.installs_premium[id];
		} else if (type == 4) {
			Views.app('popupurl/'+html);
			return;
		} else {
			obj = Store.cache.games.installs[id];
		}
	
		Views.show("offer_detail",{"data":obj,"onload" : function() { Store.showCreditLine(); }});
	},
	gameDetail: function(app_id) {
		Views.show("game",{"data":Store.cache.games[app_id]});
	},
	gameImport: function(app_id) {
		ids = Store.gameCache[app_id].ids.join("&");
	Views.app("downloadbatch/" + ids);
	},
	itemsBrowse: function() {
		if(Store.cache.itemCats) { Views.show("items_browse",{"data":Store.cache.itemCats}); return;}
		Store.api("items.get.types", function(data) {
			obj = {"categories":data};
			Store.cache.itemCats = obj;
			Views.show("items_browse",{"data":obj,"onload" : function() { Store.showCreditLine(); }});
		});
	},
	items: function(filter) {
		if(Store.cache.items[filter]) {
			Views.show("items",{"data":Store.cache.items[filter]});
			return;
		}
		Store.api("items.get", {"filter": filter}, function(data) {
			Store.cache.items[filter] = data;
			Views.show("items",{"data":data,"onload" : function() { Store.showCreditLine(); }});
		});
	},
	itemStore: function(store) {
		var stores = {1:"Surf n' Turf",2:"Pure Dance",3:"The Riviera",4:"TAP",5:"Trim & Bling",6:"Premier",7:"The Hard Edge",8:"Pistons of Power",9:"Cirque Du Freak",22:"Team Outfits",23:"Haitian Earthquake Relief Campaign",25:"Weapons"};
		var substores = {23:"100% of proceeds goes to Oxfam efforts.  Tapulous will match your donation."};
		Store.api("items.getStore", {"store": store}, function(data) {

			var items = data.content;
			var num = items.length;
			if( num == 0 ){
				// the store has no items or is invalid.  Send them to the avatar featured page instead.
				Store.getFeaturedAvatars();
				return;
			}


			data.title = stores[store];
			data.subtitle = substores[store];

			// replace "BUY" strings with local prices if we have data
			for( var i=0; i<num; i++ ){
				var item = items[i];

				
				// figure out what the display for money would be
				var localPrice = Prices.getLocalPriceStr( item.price );
				var moneyCostDisplay;
				if( localPrice !== null ){
					// local price is known, so replace "BUY" with the price
					moneyCostDisplay = localPrice;
				} else {
					// localized price data is not known
					moneyCostDisplay = "BUY";
				}

				// decide whether to display coins or money price for the item
				if( item.coins == 0 && item.price > 0 ){
					// only available for money, show money price
					item.costDisplay = moneyCostDisplay;
				} else if( item.coins > 50000 && item.price > 0 ){
					// item is available for coins and money, but costs more than 50000 coins, so show the money price
					item.costDisplay = moneyCostDisplay;
				} else {
					// show coins
					item.costDisplay = item.coins;					
				}
			}

			if( store == 600 ){
				// render the discount track packs with a different template than the normal store
				Views.show("track_packs",{"data":data,"onload":function(){Store.showCreditLine();}});
			} else {
				Views.show("items",{"data":data,"onload":function() {Store.showCreditLine();}});
			}
		});
	},
	tracks: function(filter,more) {
		
		filter = unescape(filter);

		/*
		if(Store.cache.tracks[filter] && more == undefined) {
			temp = (filter == "artists") ? "artists" : "tracks";
			Views.show(temp,{"data":Store.cache.tracks[filter],"onload" : function() { Store.showCreditLine(); }});
			return;
		}*/
		if(filter == "artists") {
			Store.api("artists.get", function(data) {
				Store.cache.tracks[filter] = data;
				Views.show("artists",{"data":data,"onload" : function() { Store.showCreditLine(); }});
			});
			return;
		}
		Store.api("songs.get", {"filter":filter, "more": more}, function(data) {

				var makeSongRow = function( songData ){
					var li = '<li class="clearfix" onclick="Store.getTrack(\''+songData.id+'\', '+songData.locked+', \''+songData.locked_text+'\');"  locked="'+songData.locked+'"><div class="thumb" style="background-image:url('+songData.image+')"></div><div class="content clearfix" style="margin-left:50px;"><div class="title ellipsis">'+songData.title+'</div><div class="subtitle ellipsis">'+songData.subtitle+'</div><div class="purchased" purchased="'+songData.purchased+'">&#10003; Purchased</div><div class="locked" locked="'+songData.locked+'"><div class="lock_img"><img src="images/lock.png" /></div><div class="lock_text">'+songData.locked_text+'</div></div></div></li>';
					return li;
				};

				if (parseInt(more) > 0) { 
					
					Store.cache.tracks[filter].songs = data.songs.concat(Store.cache.tracks[filter].songs);
					
					var html = [];
					for (var i = 0; i < data.songs.length; i++) {
						var songData = data.songs[i];
						var li = makeSongRow( songData );
						html.push( li );
					}
					$('#tracksList').append( html.join("") );
					
					$(".loading").remove();
					$('#moreRow').remove();
					if (parseInt(data.more) > 0) {
						var url = "Views.change('tracks/filter/"+filter+"/"+data.more+"');";
						$('#tracksList').append('<li id="moreRow" onclick="'+url+'">More</li>');
					}
					
				} else {
					Store.cache.tracks[filter] = data;
					
					var templateData = data;

					Views.show("tracks",{"data":data,"onload" : function() { 

								if( templateData.songs_ftw ){
									var songs = templateData.songs_ftw;
									var trackIds = [];
									var html = [];
									for( var i=0; i < songs.length; i++ ){
										var song = songs[i];
										var li = makeSongRow( song );
										trackIds.push( song.track_id );
										html.push( li );
									}
									$("#ftw-list").append( html.join("") ).show();


									// make a link for downloading all ftw
									var ftwDownloadStr = "downloadbatch/" + trackIds.join(",");
									$("#ftw-downloadall").bind( "click", function(){ Views.app( ftwDownloadStr )} );

								}

								if( templateData.songs_samples ){
									var songs = templateData.songs_samples;
									var trackIds = [];
									var html = [];
									for( var i=0; i < songs.length; i++ ){
										var song = songs[i];
										var li = makeSongRow( song );
										trackIds.push( song.track_id );
										html.push( li );
									}
									$("#samples-list").append( html.join("") ).show();

									// make a link for downloading all ftw
									var samplesDownloadStr = "downloadbatch/" + trackIds.join(",");
									$("#samples-downloadall").bind( "click", function(){ Views.app( samplesDownloadStr )} );
								}

								// show the header and explanation for the unlocked free tracks if this is a free list view
								if( filter == "free" ){
									$("#free-header-1").show();
									$("#free-header-2").show();

									if( templateData.unlocked_downloadall ){
										$("#unlocked-downloadall").show().bind( "click", function(){ Views.app( "downloadbatch/" + templateData.unlocked_downloadall ) } );
									}
								}


								var html = [];
								var songs = templateData.songs;
								for( var i=0; i < songs.length; i++ ){
									var li = makeSongRow( songs[i] );
									html.push( li );
								}
								$("#tracksList").append( html.join("") ).show();


								if (parseInt(data.more) > 0) {
									var url = "Views.change('tracks/filter/"+filter+"/"+data.more+"');";
									$('#tracksList').append('<li id="moreRow" onclick="'+url+'">More</li>');
								}
								
								//if (filter == "free") {
								//$('#tracksList').prepend('<li onclick="Store.downloadAllFree()">Download All Available Free Tracks</li>');
								//}
								
							}});
					
				}
				
				
			});
	},
	offers: function() {
		Store.api("offers.get", function(data) {
			Views.show("offers",{"data":data});
		});
	},
	getChannel: function(channel_id) {
		Store.api("channels.get", {"channel":channel_id}, function(data) {
			Views.show("channel_detail",{"data":data.channel,"onload" : function() { 
				Store.cache.channels[channel_id] = data.channel;
				//Views.alert('SSSS', 'Store Alert');
				//if (data.channel.download_all != "") $('#downloadAllTracks').remove();
				Store.showCreditLine(); 
				var headerHTML = '<li class="attention">Tracks Available</li>';
				$('#tracksList').prepend(headerHTML);
				if (parseInt(data.channel.download_all_type) < 0) {
					$('#downloadAllTracks').remove();
				}
			}});
		});
	},
	getChannelTrack: function(index, channel_id) {
		Views.show("channel_track",{"data":Store.cache.channels[channel_id]['songs'][index],"onload" : function() { Store.showCreditLine(); }});
	},
	channelDownloadAll: function(download_all, download_all_string) {
		
		if (download_all_string != "") {
			alert(downlaod_all_string);
			return;
		}
		if (download_all != "") {
			Views.app(download_all);
		}
	},
	alert: function(title, subject) {
		alert(title);
		Views.alert(title, subject);
	},
	downloadChannelTrack: function(track_id, locked, locked_text) {
		if (locked == 1) {
			alert(locked_text);
		} else {
			Views.app('download/'+track_id);
		}
	},
	downloadAllFree: function(level) {
		Store.api("tracks.getFreeURL",{"filter":"free","level":level},function(data) {
				clog( $.toJSON(data) );
			window.location.href = data.url;
		});
	},
	packages: function() {
		if(Store.cache.packageList) {
			Views.show("packages",{"data":Store.cache.packageList,"onload" : function() { Store.showCreditLine(); }});
			return;
		}
		Store.api("packages.get",function(data) {
			Store.cache.packageList = data;
			Views.show("packages",{"data":data,"onload" : function() { Store.showCreditLine(); }});
		});
	},
	albums: function() {
		if(Store.cache.albumList) {
			Views.show("packages",{"data":Store.cache.albumList});
			return;
		}
		Store.api("albums.get",function(data) {
			Store.cache.albumList = data;
			Views.show("packages",{"data":data});
		});
	},
	detail: function(item_id,type,autodownload,secondaryView) {
		var autodownload = autodownload || 0;
		var item = {};
		
		/* If we don't have it in cache, load from the server */
		if(!Store.cache.details[item_id] && type != "package") {
			
			//alert("GET (NOT IN CACHE): "+item_id);
			
			Store.api("item.get",{"item_id":item_id},function(data) {

				if( data === false ){
					// the store the item is in is not open for sale.  Send them to the avatar featured page instead.
					Store.getFeaturedAvatars();
					return;
				}

				// create a displayable price for the item if the data is available
				if( data.price > 0 ){
				  var localPrice = Prices.getLocalPriceStr( data.price );
					if( localPrice !== null ){
						// local price is known, so make a purchase button string with the price
						data.buyButtonDisplay = "Purchase item - " + localPrice;
					} else {

						// local price is not known, so display a generic purchase string
						data.buyButtonDisplay = "Purchase this item";
					}
				}

				Store.cache.details[data.id] = data;
				if(data.packageKey != "") {
					Store.detail(data.packageKey,"package");
				} else {
					Store.detail(item_id,type,autodownload,secondaryView);
				}
			});
			return;
		}
		if(type != "package") {
			/* Grab the item details from cache */
			item = Store.cache.details[item_id];
			/* If it is part of a package, set the type to package */
			if(item.packageKey != "") { type = "package"; }
		} else {
			item.packageKey = item_id;
		}
		
		//alert("GET (IN CACHE): "+item_id);
		
		switch(type) {
			/* Items and tracks, just pull from the cache */
			case "item":
			case "track":
			
				// get category info from item_id
			  var itemInfo = item_id.split("\.");
			  var category = itemInfo[0];
			
				if(item.purchased || secondaryView == 1) { 
					
					// assign special template based on the category of the item
					if (category == "gift" || category == "weapon") {
						type = "inventory_purchases";
					} else if (category == "credit") {
						type = "credit_purchases";
					} else {
						type = "item_purchased";
					}
				} else if (item.free) { 
					type += "_free"; 
				} else if (category == 'combopack') {
					type = "combopack";
				}
			  var obj = $.extend(true,{"available_coins":Store.coins},item);
				Views.show(type,{"data":obj,"onload" : function() { Store.showCreditLine(); }});
			break;
			/* Pull package from cache, or get it from server */
			case "package":
				if(package = Store.cache.packages[item.packageKey]) {
					if(package.purchased == 1) { type += "_purchased"; }
					Views.show(type,{"data":package,"onload" : function() { Store.showCreditLine(); }});
					return;
				}
				Store.api("package.get",{"packageKey":item.packageKey},function(data) {

					// create a displayable price for the item if the data is available
					if( data.price > 0 ){
						var localPrice = Prices.getLocalPriceStr( data.price );
						if( localPrice !== null ){
							// local price is known, so make a purchase button string with the price
							data.buyButtonDisplay = "Purchase track pack - " + localPrice;
						} else {
							// local price is not known, so display a generic purchase string
							data.buyButtonDisplay = "Purchase this track pack";
						}
					}
					

					Store.cache.packages[data.id] = data;
					if(data.purchased == 1) { type += "_purchased"; }
					if(autodownload && data.purchased) {
						Store.packageDownload(data.id);
					} else {
						Views.show(type,{"data":data,"onload" : function() { Store.showCreditLine(); }});
					}
				});
			break;
		}
	},
	packageDownload: function(id) {
		tracks = Store.cache.packages[id]['track_ids'].join("&");
		Views.app("downloadbatch/" + tracks);
	},
	purchase: function(type,id) {
    if( Store.isDemoUser() ){
      Views.alert("Feature not enabled for this demo.", "Demo Version");
      return;
    }


 		switch(type) {
			case "package":
				Views.loading().app("purchase/" + Store.cache.packages[id]['apple_id'] + "/p" + id);
			break;
			case "item" : 
			case "track" :
				Views.loading().app("purchase/" + Store.cache.details[id]['apple_id'] + "/" + id);
			break;
		}
	},
	redeem: function(type,id) {

    if( Store.isDemoUser() ){
      Views.alert("Feature not enabled for this demo.", "Demo Version");
      return;
    }
	
		if(!confirm("Are you sure you want to use your coins to redeem this?")) { return; }
		Views.loading();
		switch(type) {
			case "package":
				
				Store.api("redeem.package",{"package_id":id}, function(data) {
					if(!data.error) {
						Store.coins = parseInt(Store.coins) - parseInt(Store.cache.packages[id].coins);
						Views.app('updateuser');
						Views.show(type + "_purchased",{"data":Store.cache.packages[id],"onload" : function() { Store.showCreditLine(); }});
					} else {
						Views.alert(data.reason,"Problem");
						$(".loading").remove();
						
					}
				});
			break;
			case "track":
			case "item":
			case "combopack":
				Store.api("redeem",{"item_id":id}, function(data) {
					if(!data.error) {
						Store.coins -= Store.cache.details[id].coins;
						Store.cache.details[id].purchased = 1;
						if (type == "combopack") type = "item";
						Views.show(type + "_purchased",{"data":Store.cache.details[id],"onload" : function() { Store.showCreditLine(); Views.app('updateuser'); }});
						
					} else {
						Views.alert(data.reason,"Problem");
						$(".loading").remove();
					}
				});
			break;
			case "weapon":
			case "gift":
			case "credit":
				Store.api("redeem",{"item_id":id}, function(data) {
					if(!data.error) {
						Store.coins -= Store.cache.details[id].coins;
						template = "inventory_purchases";
						if (type == "credit") template = "credit_purchases";
						Views.show(template,{"data":Store.cache.details[id],"onload" : function() { 
							Store.showCreditLine(); 
							Views.app('updateuser');
							 if (type == "credit") { Store.updateCareer(); }
						}});
					} else {
						Views.alert(data.reason,"Problem");
						$(".loading").remove();
					}
				});
			break;
		}
	},
	updateCareer: function() {
		Store.api("career.get",{},function(data) {
	    	if (data.coins) {
	    		Store.coins = data.coins;
	    		Store.credits = data.credits;
	    		Store.showCreditLine();
	    	}
	    });
	},
	initiateSession: function() {
		Store.api("session.get",{},function(data) {
	    	if (data.career.coins) {
	    		Store.coins = data.career.coins;
	    		Store.credits = data.career.credits;
	    		Store.showCreditLine();
	    	}
	
			Store.showCampaign = parseInt(data.campaign);
	    	
	    	/*// setup avatar page
	    	Store.featuredCache.avatars = data.avatars;
	    	alert($.toJSON(Store.featuredCache.avatars));
	    	
	    	if (window.location.hash.indexOf('items/featured') >= 0) {
	    		//$('#featured_top').attr('style', Store.featuredCache.avatars.css_top);
	    		var cssObject = {
	    			'height' : '172px'
	    		};
	    		$('#featured_top').css(cssObject);
	    		//alert($('#featured_top').attr('style'));
	    		alert(Store.featuredCache.avatars.css_top);
	    		//$('#featured_top').css('width', Store.featuredCache.avatars.width_top);
	    		//$('#featured_top').css('background', Store.featuredCache.avatars.background_top);
	    		//$('#featured_top').click(function() { Views.change(Store.featuredCache.avatars.url_top); });
	    	}*/
	    	
	    	
	    });
	},
	redeemForCredit: function(type,id) {
    if( Store.isDemoUser() ){
      Views.alert("Feature not enabled for this demo.", "Demo Version");
      return;
    }

		if(!confirm("Are you sure you want to use your credit to redeem this?")) { return; }
		Views.loading();
		switch(type) {
			case "package":
				Store.api("redeem.package",{"package_id":id,"for_credit":1}, function(data) {
					Store.credits = parseInt(Store.credits) - parseInt(Store.cache.packages[id].credits);
					
					if(!data.error) {
						Views.show(type + "_purchased",{"data":Store.cache.packages[id]});
					} else {
						Views.alert(data.reason,"Problem");
						$(".loading").remove();
					}
				});
			break;
		}
	},
	purchaseSuccess : function(json) {
		try {
			if(json.item_id.substr(0,1) == "p") {
				id = json.item_id.replace("p","");
				Store.resetCache();
				Store.detail(id,"package",1);
			} else {
				// always reset cache after a purchase
				Store.resetCache();
				
				// get category info from item id
				itemInfo = json.item_id.split("\.");
				type = itemInfo[0];
				
				// Update the user
				Views.app('updateuser');
								
				secondaryView = 0;
				if (type == "song") { 
					detailType = "track"; 
				} else if (type == "credit" || type == "weapon" || type == "gift") {
					secondaryView = 1;
					detailType = "item";
				} else { 
					detailType = "item"; 
				}
				
				Store.detail(json.item_id,detailType,0,secondaryView);
			}
			
			// Update Store
			Store.updateCareer();
			
		} catch(e) { alert(e.message); Store.purchaseFailed(json); }
 	},
	purchaseCanceled : function(json) {
		item = Store.cache.details[json.item_id];
		type = item.category;
		Views.show(type + "_purchased",{"data":item});
	},
	purchaseFailed : function(json) {
		Views.alert("Your transaction could not be completed","Problem");
		$(".loading").remove();
	},
	showCreditLine: function() {
		if ($('#creditUL').length != 0) {
			$('#creditUL').remove();
		} 
		
		var creditHtml = '<ul id="creditUL" class="intermediate_list"><li class="very_sm_font question">';
		
		if (Store.showCampaign == 1) {
			creditHtml += '<div onclick="Views.app(\'popupurl/http://pub.tapulous.com/user/ttr3/campaigns/dehood.php?src=storeCredits&t=1&d='+Store.session.device_id+'&ak='+API_KEY+'\')" style="float:right;text-align:center; padding:3px 8px; margin-left:0px; margin-top:3px; background:#3c5665; border:1px solid #222a35; -webkit-border-radius: 6px;font-size:10px; color:#fff;">GET FREE MUSIC</div>';
		}
		
		creditHtml += '<div style="float:left; margin-left:1px; padding-top:6px; text-decoration:none; border-bottom:1px solid #5d6570;" class="very_sm_font" onclick="return false; Views.app(\'popupurl/http://img.tapulous.com/ttr/3.1/interstitials/tips/coins_and_credits.html\');">COINS:<span if="coins" class="highlight very_sm_font">'+Store.coins+'</span> </div><div style="float:left; padding-top:5px;" class="very_sm_font"><span style="padding:0px 6px;"><img src="images/store_pipes.png"></span></div><div style="float:left; text-decoration:none; border-bottom:1px solid #5d6570; padding-top:6px;" onclick="return false; Views.app(\'popupurl/http://img.tapulous.com/ttr/3.1/interstitials/tips/coins_and_credits.html\');" class="very_sm_font">CREDITS:<span if="credits" class="highlight very_sm_font">'+Store.credits+'</span></div><div class="clearfix"></div></li></ul>';


		$('#creditLine').append(creditHtml).show();	
	},
	toggleOffers: function(type) {

		if (type == 2) {
			$('#offers_list').show();
			$('#installs_list').hide();
			$('#offers_title').addClass('selected');
			$('#installs_title').removeClass('selected');
		} else {
			$('#installs_list').show();
			$('#offers_list').hide();
			$('#installs_title').addClass('selected');
			$('#offers_title').removeClass('selected');
		}
	},
	setOfferpalNotify: function( elCheckbox ){
		// persist the value
		var setting = (elCheckbox.checked) ? 1 : 0;
		Store.api("offerpal.notify.set", {"setting": setting }, function(data) {});

		// update the cache with the new offerpal setting so that switching between tabs correctly shows the latest offerpal setting
		Store.cache.games.offerpal_notify = setting;
	},


	api : function(method,data,cb) {
		if(typeof data == "function") {
			cb = data;
			data = {};
		}
		data = $.extend(true,{"method" : method, api_key: API_KEY },data,Store.session);
		Store.ajax = (cb) ? $.post("api/", data, cb, "json") : $.post("api/", data, "json");
	}
};

$.extend($.expr[":"], {  
    "icontains": function(elem, i, match, array) {  
        return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;  
    }
}); 

function search() {
	val = $("input").val().toLowerCase();
	if(val.length) {
		$("li").hide().filter(":icontains(" + val + ")").show();
	} else {
		$("li").show();
	}
}


var Prices = function(){
	var _US_Prices = [0,0.99,1.99,2.99,3.99,4.99,5.99,6.99,7.99,8.99,9.99,10.99,11.99,12.99,13.99,14.99,15.99,16.99,
										17.99,18.99,19.99,20.99,21.99,22.99,23.99,24.99,25.99,26.99,27.99,28.99,29.99,30.99,31.99,32.99,
										33.99,34.99,35.99,36.99,37.99,38.99,39.99,40.99,41.99,42.99,43.99,44.99,45.99,46.99,47.99,48.99,
										49.99,54.99,59.99,64.99,69.99,74.99,79.99,84.99,89.99,94.99,99.99,109.99,119.99,129.99,139.99,
										149.99,159.99,169.99,179.99,189.99,199.99,209.99,219.99,229.99,239.99,249.99,299.99,349.99,399.99,
										449.99,499.99,599.99,699.99,799.99,899.99,999.99];
	var _localPrices = null;

  function init( prices ){
	if( typeof( prices ) == "object" ){
		_localPrices = prices.pricing_info;
	}
  }
	
	function _getPriceTier( us_price ){
		if( typeof( us_price ) == "string" ){
			us_price = parseFloat( us_price );
		}
		return _US_Prices.indexOf( us_price );
	}
	
	function getLocalPriceStr( us_price ){
		if( _localPrices !== null ){
			var tier = _getPriceTier( us_price );
			if( tier !== null ){
				var priceInfo = _localPrices[ tier ];
				if( typeof(priceInfo) !== "undefined" ){
					return "" + priceInfo.c + priceInfo.p;
				} else {
				}
			}
		}
		return null;
	}

	return {
		init : init,
		getLocalPriceStr : getLocalPriceStr
	};

}();





/*
 * Initializing
 * This stuff runs on page load
 *
 */
$(function init() {
	// Setup the event handlers
	Store.init(Session);
	//alert("The store will be back in a second");
});



	</script>

<script>var API_KEY = 'HORRZVLW-H88F-5D61-KGEF-Q8M5NGCBVFYB';</script>

<div style="text-align:center; border-left: none; border-right: none; background: -webkit-gradient(linear,left top, left bottom, from(#979da9), color-stop(0.5,#626c7d), color-stop(0.5,#505a6d), to(#323e54)); -webkit-border-bottom-left-radius: 8px;-webkit-border-bottom-right-radius: 8px; -webkit-box-shadow: 0px 1px 0px #000;">
<li onclick="Views.app('downloadbatch/all')">Tap to Download All Tracks</li>
<li onclick="Views.app('downloadbatch/extreme')">Tap to Download Extreme Tracks</li>
<li onclick="Views.app('downloadbatch/hard')">Tap to Download Hard Tracks</li>
<li onclick="Views.app('downloadbatch/medium')">Tap to Download Medium Tracks</li>
<li onclick="Views.app('downloadbatch/easy')">Tap to Download Easy Tracks</li>
</ul>
</div>

    </body>
</html>
